package letsjava.pattern.observer;

import java.util.Observable;
import java.util.Observer;

public class PriceObserver implements Observer{
	 
	public void update(Observable obj,Object arg){ 
		if (arg instanceof Float){
			//price=((Float)arg).floatValue(); 
			System.out.println("PriceObserver :price c1hanget to "+arg);
		}
	}
	
	public static void main(String[] args){
		Product product = new Product();
		
		NameObserver nameobs = new NameObserver();
		PriceObserver priceobs = new PriceObserver();
		
		product.addObserver(nameobs); 
		product.addObserver(priceobs);
		
		product.setName("hello");
		product.setPrice(1.11111f);
	}
}
